package impl

import (
	"sync"

	"gitee.com/go-course/go9/tree/master/projects/vblog/api/apps/user"
	"gitee.com/go-course/go9/tree/master/projects/vblog/api/conf"
)

// 业务实例类的构造函数
func NewImpl() user.Service {
	return &Impl{
		Auth:     conf.C().Auth,
		sessions: map[string]string{},
	}
}

// 负责实现service
// 用户密码和密码放到配置上的, 依赖配置对象
type Impl struct {
	Auth *conf.Auth

	// 使用一个map保存登录用户的session
	sessions map[string]string
	lock     sync.Mutex
}
